package cn.wx.scholar.neo4j.service;

import org.neo4j.ogm.model.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.wx.scholar.neo4j.entity.qo.Neo4jFieldQ;
import cn.wx.scholar.neo4j.repository.FieldRepository;
import cn.wx.scholar.tool.neo4j.Neo4jQueryTools;

@Service
public class Neo4jFieldService {
	
	@Autowired
    private FieldRepository fieldRepositiory;

	public Object getFields(Neo4jFieldQ neo4jFieldQ) {
		/**
		 * 对like查询的组装
		 */
		final String name_ = Neo4jQueryTools.basicEqual(neo4jFieldQ.getName());
		Result result = fieldRepositiory.getFields(name_);
		if(result == null) {
			return null;
		}
		return result.queryResults();
	}
}
